package cn.minimelon.api.controller.common;

import cn.minimelon.api.domain.common.AjaxResult;
import cn.minimelon.api.domain.common.ProgressInfo;
import org.noear.solon.annotation.*;
import org.noear.solon.data.cache.CacheService;

/**
 * 进度条接口
 */
@Controller
public class ProgressInfoController {
    @Inject
    private CacheService cacheService;

    /**
     * 获取当前进度信息
     *
     * @param key 进度ID
     * @return 进度信息
     */
    @Get
    @Mapping("/progress/{key}")
    public AjaxResult getInfo(@Param String key) {
        ProgressInfo progressInfo = cacheService.get(key, ProgressInfo.class);
        return AjaxResult.success(progressInfo);
    }

}
